
import sys
sys.path.append("/home/cole/project_graduate/mmdetection")
from mmdet.apis import init_detector,inference_detector
import torch
from mmengine.config import Config
from mmdet.registry import DATASETS
from mmengine.registry import init_default_scope
import copy
import cv2
import os



config_file  = "/home/cole/project_graduate/mmdetection/my_test_code/configs/slot_config.py"
cfg = Config.fromfile(config_file)
init_default_scope(cfg.get('default_scope', 'mmdet'))


model = init_detector(cfg)
img_path = "/home/cole/Documents/ps2.0/testing/all/0001.jpg"
img = cv2.imread(img_path)
result = inference_detector(model,img)